package Distinction;

class window1 extends Thread{

    // 设定票数
    private int tickets = 100;

    public void run(){

        while(true){
            if(tickets>0){
                System.out.println(Thread.currentThread().getName()
                        +"窗口出售了第"+tickets--+"张票");
            }
        }
    }

}

public class TicketWindow1 {

    public static void main(String[] args) {

        // 创建4个线程对象并启动，代表4个销售窗口
        new window1().start();
        new window1().start();
        new window1().start();
        new window1().start();

    }

}
